package com.ourteam.workspace.api;

import com.ourteam.frame.web.AbstractSearchModel;
import com.ourteam.workspace.dao.WorkspaceProductDatabaseRelateDAOQueryBean;
import com.ourteam.workspace.domain.WorkspaceProductDatabaseRelateBean;

public class WorkspaceDatabaseRelateSearchModel
		extends AbstractSearchModel<WorkspaceProductDatabaseRelateDAOQueryBean> {

	private long workspaceId;

	public long getWorkspaceId() {
		return workspaceId;
	}

	public void setWorkspaceId(long workspaceId) {
		this.workspaceId = workspaceId;
	}

	@Override
	public String getMappedDAOField(String aProperty) {
		return WorkspaceProductDatabaseRelateBean.getMappedDAOField(aProperty);
	}

	@Override
	protected void doBuildQueryBean(WorkspaceProductDatabaseRelateDAOQueryBean queryBean) throws Exception {

		WorkspaceProductDatabaseRelateDAOQueryBean.Criteria criteria = queryBean.createCriteria();

		if (workspaceId != 0) {
			criteria.andWorkspaceIdEqualTo(workspaceId);
		}

	}

}
